#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long int;
const int mod = 1e9 + 7;
const long long inf = 1e11 + 5;
const ll dd = 3e5 + 5;
int t;
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
void fun() {}
const int N = 2e5 + 5;
ll n, k, p, ans, curr;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> k >> n;
  vector<ll> a(k + 1), b(n + 1), prefix(k + 1, 0);
  map<ll, ll> mp;
  set<ll> initial_point;
  for (ll i = 1; i <= k; i++) {
    cin >> a[i];
    prefix[i] = prefix[i - 1] + a[i];
  }
  for (ll i = 1; i <= n; i++) {
    cin >> b[i];
    mp[b[i]] = 1;
  }
  for (ll i = 1; i <= k; i++) {
    initial_point.insert(b[1] - prefix[i]);
  }
  for (auto d : initial_point) {
    set<ll> minset;
    for (ll i = 1; i <= k; i++) {
      minset.insert(d + prefix[i]);
    }
    bool have = true;
    for (int i = 1; i <= n; i++) {
      if (minset.count(b[i]) == 0) {
        have = false;
        break;
      }
    }
    if (have) {
      ans++;
    }
  }
  cout << ans << '\n';
}
