#include <bits/stdc++.h>
using namespace std;
double dat[100][100];
int dp[6][1010];
int prime[10000001];
char str[1010][1010];
vector<pair<int, int> > pc[100001];
int ABS(int a) { return max(a, -a); }
int main() {
  int n, m, a[10001];
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  int cnt, tmp;
  for (int l = 0; l < n; l++) {
    for (int r = l; r < n; r++) {
      tmp = 0;
      for (int i = l; i <= r; i++) {
        tmp += a[i];
      }
      if (tmp % m == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
