#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[205];
long long b[205], c[205];
long long dp[2][205][5005];
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (long long(i) = (1); (i) <= (n); (i)++) {
    cin >> a[i];
    while (a[i] % 2 == 0) b[i]++, a[i] /= 2;
    while (a[i] % 5 == 0) c[i]++, a[i] /= 5;
  }
  for (long long(j) = (0); (j) <= (k); (j)++)
    for (long long(l) = (0); (l) <= (5000); (l)++) dp[0][j][l] = -1e9;
  dp[0][0][0] = 0;
  for (long long(i) = (0); (i) <= (n - 1); (i)++) {
    for (long long(j) = (0); (j) <= (k); (j)++)
      for (long long(l) = (0); (l) <= (5000); (l)++)
        dp[(i + 1) & 1][j][l] = -1e9;
    for (long long(j) = (0); (j) <= (k); (j)++) {
      for (long long(l) = (0); (l) <= (5000); (l)++) {
        (dp[(i + 1) & 1][j][l]) =
            max((dp[(i + 1) & 1][j][l]), (dp[i & 1][j][l]));
        if (j + 1 <= k && l + c[i + 1] <= 5000) {
          (dp[(i + 1) & 1][j + 1][l + c[i + 1]]) =
              max((dp[(i + 1) & 1][j + 1][l + c[i + 1]]),
                  (dp[i & 1][j][l] + b[i + 1]));
        }
      }
    }
  }
  long long ans = 0;
  for (long long(i) = (0); (i) <= (5000); (i)++)
    (ans) = max((ans), (min(dp[n % 2][k][i], i)));
  cout << ans << endl;
  return 0;
}
