#include <bits/stdc++.h>
using namespace std;
int f[101][100001];
int n, m;
int a[101];
int s[101];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[i] = a[i - 1] + a[i];
  }
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i][0] = 1;
    for (int j = 1; j <= m; j++) {
      f[i][j] = s[a[i]] - s[j];
    }
  }
  printf("%d", f[n][m]);
}
