#include <bits/stdc++.h>
int child[100005];
int i, j, n, m, ans, H[100005];
int main() {
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &child[i]);
  for (i = 1; i <= 100000; i++)
    for (j = 1; j <= n; j++)
      if (!H[j]) {
        child[j] -= m;
        if (child[j] <= 0) {
          H[j] = 1;
          ans = j;
        }
      }
  printf("%d\n", ans);
  return 0;
}
