#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, m, n, sum, page, s[8];
  cin >> page;
  j = 0;
  sum = 0;
  for (i = 1; i <= 7; i++) scanf("%d", &s[i]);
  while (sum <= page) {
    for (j = 1; j <= 7; j++) {
      sum = sum + s[j];
      if (sum >= page) {
        l = 0;
        break;
      }
    }
    if (l == 0) break;
  }
  while (j > 7) j = j - 7;
  printf("%d\n", j);
}
