#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  while (cin >> n >> m) {
    long long a[1000] = {0};
    int amount = 0;
    for (int i = 1; i <= n; i++) {
      int t;
      cin >> t;
      a[i] = t % m;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j++) {
        int sum = 0;
        for (int k = i; k <= j; k++) {
          sum += a[k];
        }
        if (sum % m == 0) amount++;
      }
    }
    printf("%d\n", amount);
  }
}
