#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
int ans = 0, kol = 0;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ans += x / 10;
    kol += (10 - (x + 9) / 10);
    a[i] = 10 - x % 10;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i] > 0 && a[i] < 10)
      if (k >= a[i]) {
        k -= a[i];
        ans++;
      }
  }
  ans += min(kol, k / 10);
  cout << ans;
  return 0;
}
