#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
struct mi {
  int v;
  explicit operator int() const { return v; }
  mi() { v = 0; }
  mi(ll _v) : v(_v % MOD) { v += (v < 0) * MOD; }
};
mi& operator+=(mi& a, mi b) {
  if ((a.v += b.v) >= MOD) a.v -= MOD;
  return a;
}
mi& operator-=(mi& a, mi b) {
  if ((a.v -= b.v) < 0) a.v += MOD;
  return a;
}
mi operator+(mi a, mi b) { return a += b; }
mi operator-(mi a, mi b) { return a -= b; }
mi operator*(mi a, mi b) { return mi((ll)a.v * b.v); }
mi& operator*=(mi& a, mi b) { return a = a * b; }
mi pow(mi a, ll p) {
  assert(p >= 0);
  return p == 0 ? 1 : pow(a * a, p / 2) * (p & 1 ? a : 1);
}
mi inv(mi a) {
  assert(a.v != 0);
  return pow(a, MOD - 2);
}
mi operator/(mi a, mi b) { return a * inv(b); }
void setIO(string name = "") {
  cin.tie(0)->sync_with_stdio(0);
  if ((int)(name).size()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n, k;
  cin >> k >> n;
  multiset<int> a;
  int sum = 0;
  vector<int> have(k);
  for (int i = 0; i < k; ++i) {
    int x;
    cin >> x;
    sum += x;
    a.insert(sum);
    have[i] = sum;
  }
  int b[n];
  for (int i = 0; i < n; ++i) cin >> b[i];
  set<int> second;
  for (int i = 0; i < k; ++i) {
    a.erase(a.find(have[i]));
    int val = b[0] - have[i];
    bool ok = true;
    for (int j = 1; j < n; ++j) {
      if (a.find(b[j] - val) == a.end()) {
        ok = false;
      }
    }
    if (ok) second.insert(val);
    a.insert(have[i]);
  }
  cout << second.size() << "\n";
}
