#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int a[n + 1], b[10] = {0}, ans = 0;
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
    ans = ans + a[i] / 10;
    b[10 - (a[i] % 10)]++;
  }
  for (int i = 1; i < 10; i++) {
    while (k >= i && b[i]) {
      k -= i;
      b[i]--;
      ans++;
    }
  }
  ans = ans + k / 10;
  ans = min(ans, 10 * n);
  cout << ans << endl;
  return 0;
}
