#include <bits/stdc++.h>
using namespace std;
template <class T>
void show(const vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << endl;
}
const long long sze = 3e5 + 50, oo = 1e18 + 500, mod = 1000000007;
const long double eps = 1e-9, PI = 2 * acos(0.0);
vector<long long> vertices[sze];
vector<char> visit(sze, false);
vector<long long> arr(sze, 0);
long long n, m, k;
long long cnt = 0;
long long pw2[210], pw5[210];
long long dp[2][210][6000];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> m;
    long long val = m;
    cnt = 0;
    while (m % 2 == 0) {
      m /= 2;
      cnt++;
    }
    pw2[i] = cnt;
    cnt = 0;
    while (val % 5 == 0) {
      val /= 5;
      cnt++;
    }
    pw5[i] = cnt;
  }
  long long c = 0, p = 1;
  for (long long i = 0; i < 2; i++) {
    for (long long j = 0; j <= k; j++) {
      for (long long l = 0; l < 6000; l++) {
        dp[i][j][l] = -1;
      }
    }
  }
  dp[c][0][0] = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      for (long long l = 0; l < 6000; l++) {
        if (dp[c][j][l] > -1) {
          dp[p][j][l] = max(dp[p][j][l], dp[c][j][l]);
          ;
          dp[p][j + 1][l + pw5[i]] =
              max(dp[p][j + 1][l + pw5[i]], dp[c][j][l] + pw2[i]);
          ;
        }
      }
    }
    swap(c, p);
  }
  long long ans = 0;
  for (long long l = 0; l < 6000; l++) {
    long long val = min(l, dp[c][k][l]);
    ans = max(ans, val);
    ;
  }
  cout << ans;
  return 0;
}
