#include <bits/stdc++.h>
using namespace std;
int tree[10005];
int n, m;
int lowbit(int t) { return t & (-t); }
void add(int x, int y) {
  for (int i = x; i <= n; i += lowbit(i)) tree[i] += y;
}
int getsum(int x) {
  int ans = 0;
  for (int i = x; i > 0; i -= lowbit(i)) ans += tree[i];
  return ans;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> tree[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int sum = getsum(j) - getsum(i - 1);
      if (sum % m == 0) ans++;
    }
  }
  printf("%d", ans);
}
