about summary refs log tree commit diff
path: root/others/volume1/029.pas
blob: c590f47d771b97d0120e2d4a2dc8d14b2365e3ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
uses clib;

var
  n, i: int16;
  p: int64;
  a, b: array of int64;

begin
  readln(n, p);
  setlength(a, n);
  setlength(b, n);
  for i := 0 to n - 1 do
    begin
      read(a[i]);
      b[i] := a[i]
    end;
  qsort(a);
  p := a[p - 1];
  for i := 0 to n - 1 do
    if b[i] = p then
      break;
  writeln(p, ' ', i + 1)
end.