#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  scanf("%d %d", &k, &n);
  unordered_map<int, int> scores;
  int s = 0;
  for (int i = 0; i < k; i++) {
    int a;
    scanf("%d", &a);
    s += a;
    if (scores.count(s))
      scores[s]++;
    else
      scores.insert({s, 1});
  }
  int b0;
  bool flag = false;
  unordered_map<int, int> points;
  for (int i = 0; i < n; i++) {
    int b;
    scanf("%d", &b);
    if (!flag) {
      b0 = b;
      flag = true;
    }
    if (points.count(b - b0))
      points[b - b0]++;
    else
      points.insert({b - b0, 1});
  }
  int ans = 0;
  for (auto score : scores) {
    bool found = true;
    for (auto point : points)
      if (!scores.count(score.first + point.first) ||
          scores[score.first + point.first] < point.second) {
        found = false;
        break;
      }
    if (found) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
