#include <bits/stdc++.h>
using namespace std;
const long double E = 2.71828182845904523536;
const long double pi = acos(-1);
const double eps = 1e-9;
const long long mod = 1e9 + 7;
const long long inf = 1LL << 60;
const int N = 200200;
long long a[N];
long long h, n, d;
bool ok(long long x) {
  long long h1 = h;
  if (x && d > inf / x) return 1;
  h1 -= (d * x);
  if (h1 <= 0) return 1;
  for (int i = 0; i < n; i++) {
    h1 += a[i];
    if (h1 <= 0) return 1;
  }
  return 0;
}
int main() {
  scanf("%lld%lld", &h, &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    d += a[i];
  }
  d *= -1;
  if (d <= 0) {
    for (int i = 0; i < n; i++) {
      h += a[i];
      if (h <= 0) {
        printf("%d", i + 1);
        return 0;
      }
    }
    printf("-1");
    return 0;
  }
  long long lo = 0, hi = inf;
  while (hi > lo) {
    long long mid = (lo + hi) / 2;
    if (ok(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  long long ans = n * lo;
  h -= (lo * d);
  for (int i = 0; i < n; i++) {
    if (h <= 0) break;
    h += a[i];
    ans++;
  }
  printf("%lld", ans);
  return 0;
}
