#include <bits/stdc++.h>
using namespace std;
int M[100][100];
int color[100];
const int TABLEMAX = 510000;
const int MOD = 1000000007;
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {-1, 0, 1, 0};
static const int NIL = -1;
vector<long long> factor;
vector<long long> factor_num;
long long n;
template <class X>
void printArray(X *array, X);
void printVector(vector<long long> &v);
void printDimention(vector<vector<long long> > &dv);
int factor2(int);
long long combination(int, int);
int factorial(int, int);
int find_digits(int);
int findSumOfDigits(int);
int degree(int);
int shishagonyu(double);
int roundUp(double);
int roundDown(double);
int roundOff(double);
int gcd(int, int);
int lcm(int, int);
void prime_factorization(int);
int Eratosthenes(int);
bool odd_even(int);
long long modinv(long long, long long);
long long modpow(long long, long long, long long);
long long abs_ll(long long);
long long div_one(long long, long long);
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long m;
  cin >> n >> m;
  long long a[n], dp[n];
  long long sum = 0;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
    sum += (a[i] % m);
    sum %= m;
    dp[i] = sum;
  }
  printArray(dp, n);
  long long cnt = 0;
  for (int i = (0); i < (n); ++i) {
    for (int j = (i); j < (n); ++j) {
      if (i == 0) {
        if (dp[j] == 0) cnt++;
      } else {
        if ((dp[j] - dp[i - 1]) == 0) cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
template <class X>
void printArray(X array[], X n) {
  for (int i = (0); i < (n); ++i) {
    if (i) cout << " ";
    cout << array[i];
  }
  cout << endl;
}
void printVector(vector<long long> &v) {
  for (int i = (0); i < ((int)v.size()); ++i) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
void printDimention(vector<vector<long long> > &dv) {
  for (int i = (0); i < ((int)dv.size()); ++i) {
    for (int j = (0); j < ((int)dv[i].size()); ++j) {
      if (j) cout << " ";
      cout << dv[i][j];
    }
    cout << endl;
  }
}
int factor2(int num) {
  int cnt = 0;
  while (num % 2 == 0) {
    num /= 2;
    cnt++;
  }
  return cnt;
}
long long combination(int n, int r) {
  long long up = 1, down = 1;
  long long up_tmp = n, down_tmp = r;
  if (r == 0) return 1;
  for (int i = (0); i < (r); ++i) {
    up *= up_tmp;
    up_tmp--;
    down *= down_tmp;
    down_tmp--;
  }
  return up / down;
}
int factorial(int n, int r) {
  if (n < r) {
    cout << "error" << endl;
    return 0;
  } else {
    int res = 1;
    while (r) {
      r--;
      res *= n;
      n--;
    }
    return res;
  }
}
int find_digits(int n) {
  int digit = 0;
  while (n) {
    n /= 10;
    digit++;
  }
  return digit;
}
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int degree(int n) {
  int count = 0;
  while (1) {
    if (count <= 0) break;
    count /= 2;
    count++;
  }
  return count;
}
int shishagonyu(double x) { return (int)(x < 0.0 ? x - 0.5 : x + 0.5); }
int roundUp(double n) {
  if (n >= 0) {
    return (int)n + 1;
  } else {
    return (int)n - 1;
  }
}
int roundDown(double n) { return (int)n; }
int roundOff(double n) {
  double decimal = 0;
  decimal = n - (int)n;
  if (decimal >= 0.5 || decimal <= -0.5) {
    return roundUp(n);
  } else {
    return roundDown(n);
  }
}
int gcd(int m, int n) {
  if (m == 0 || n == 0) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
int lcm(int m, int n) {
  if (m == 0 || n == 0) return 0;
  return ((m / gcd(m, n)) * n);
}
void prime_factorization(int n) {
  int a = 2, res;
  bool flg = false;
  while (n >= a * a) {
    if (n % a == 0) {
      res = a;
      if (flg) {
        factor_num[factor.size() - 1]++;
      } else {
        factor.push_back(0);
        factor_num.push_back(1);
        factor[factor.size() - 1] = res;
      }
      n /= a;
      flg = true;
    } else {
      a++;
      flg = false;
    }
  }
  res = n;
  if (factor[factor.size() - 1] == res) {
    factor_num[factor.size() - 1]++;
  } else {
    factor.push_back(res);
    factor_num.push_back(1);
  }
}
int Eratosthenes(int n) {
  bool prime[n];
  for (int i = (0); i < (n); ++i) prime[i] = true;
  for (int i = 2; i < sqrt(n); i++) {
    if (prime[i]) {
      for (int j = 0; i * (j + 2) < n; j++) {
        prime[i * (j + 2)] = false;
      }
    }
  }
  int cnt = 0;
  for (int i = 2; i < n; i++) {
    if (prime[i]) {
      cnt++;
    }
  }
  return cnt;
}
bool odd_even(int num) {
  bool judge;
  if (num % 2) {
    judge = true;
  } else {
    judge = false;
  }
  return judge;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long abs_ll(long long a) {
  if (a >= 0) {
    return a;
  } else {
    return -a;
  }
}
long long div_one(long long res, long long div) {
  return (res + div - 1) / div;
}
