#include <bits/stdc++.h>
using namespace std;
int n, m, a;
queue<pair<int, int> > q;
int ans;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    q.push(make_pair(a, i));
  }
  while (!q.empty()) {
    int x = q.front().first;
    x -= m;
    if (x > 0) {
      q.push(make_pair(x, q.front().second));
    }
    ans = q.front().second;
    q.pop();
  }
  printf("%d\n", ans);
  return 0;
}
