#include <bits/stdc++.h>
using namespace std;
long long n, m, i, terbesar, j, skrng;
bool menang;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  terbesar = 0;
  for (i = 0; i < m; i++) {
    cin >> s;
    menang = false;
    for (j = 0; j < s.length(); j++) {
      if (s[j] == '0') {
        menang = true;
        break;
      }
    }
    if (menang) {
      skrng++;
      if (skrng > terbesar) {
        terbesar = skrng;
      }
    } else {
      skrng = 0;
    }
  }
  cout << terbesar << '\n';
  return 0;
}
