#include <bits/stdc++.h>
using namespace std;
int main() {
  int c, i, j, n, m, a[1000000];
  scanf("%d%d", &n, &m);
  memset(a, -1, sizeof(a));
  c = n;
  for (i = 0; i < n; i++) scanf("%d", a + i);
  for (i = 0; a[i] != -1; i++)
    if (i < n) {
      if (a[i] > m) a[i] -= m, a[c] = i, c++;
    } else if (a[a[i]] > m)
      a[a[i]] -= m, a[c] = a[i], c++;
  i--;
  if (i < n)
    printf("%d", i + 1);
  else
    printf("%d", a[i] + 1);
  return 0;
}
