#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  vector<pair<int, int> > v;
  int i;
  int d;
  for (i = 0; i < n; i++) {
    scanf("%d", &d);
    v.push_back(make_pair(i, d));
  }
  int l = 0;
  i = 0;
  while (v.size() > 1) {
    if (m >= v[i].second) {
      v.erase(v.begin() + i);
    } else {
      v.push_back(make_pair(v[i].first, v[i].second - m));
      v.erase(v.begin() + i);
    }
  }
  printf("%d", v[v.size() - 1].first + 1);
}
