#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int lastindex = 0;
  int count = 0;
  int index = 0;
  while (count != n) {
    if (arr[index] > 0) {
      arr[index] -= m;
      lastindex = index;
    }
    if (arr[index] <= 0) {
      count++;
    } else {
      count = 0;
    }
    index++;
    if (index >= n) index = 0;
  }
  cout << lastindex + 1;
}
