#include <bits/stdc++.h>
using namespace std;
long long a[200009];
long long f[200009][2], n, T;
void upd(long long x, long long v, long long t) {
  while (x <= n) {
    f[x][t] += v;
    x += (x & -x);
  }
}
long long cnt(long long x, long long v) {
  long long ans = 0;
  while (x) {
    ans += f[x][v];
    x -= (x & -x);
  }
  return ans;
}
long long Cnt(long long l, long long C, long long t) {
  if (!C) return 0;
  long long r = l + C - 1;
  r = (r - 1) % n + 1;
  if (l + C - 1 <= n) return cnt(r, t) - cnt(l - 1, t);
  return cnt(n, t) - cnt(l - 1, t) + cnt(r, t);
}
int main() {
  cin >> n >> T;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    upd(i, a[i], 0);
    upd(i, 1, 1);
  }
  long long cr = 1;
  long long ans = 0;
  while (T) {
    long long S = cnt(n, 0), C = cnt(n, 1);
    if (!S) break;
    ans += (T / S) * C;
    T %= S;
    long long lo = 0, hi = n - 1;
    while (lo < hi) {
      long long mid = (lo + hi + 1) / 2;
      if (Cnt(cr, mid, 0) <= T)
        lo = mid;
      else
        hi = mid - 1;
    }
    ans += Cnt(cr, lo, 1);
    T -= Cnt(cr, lo, 0);
    cr = cr + lo;
    cr = (cr - 1) % n + 1;
    upd(cr, -a[cr], 0);
    upd(cr, -1, 1);
    cr = cr % n + 1;
  }
  cout << ans << endl;
}
