#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000;
int n, k, a[MAXN + 5], ans, pt, kk;
queue<int> q;
bool cmp(int x, int y) { return ((x % 10) > (y % 10)); }
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans += a[i] / 10;
  }
  sort(a, a + n, cmp);
  while (k > 0) {
    if (a[pt] != 100) {
      if (10 - a[pt] % 10 <= k) {
        ans++;
        k -= 10 - (a[pt] % 10);
        a[pt] += 10 - (a[pt] % 10);
      }
    }
    pt = (pt + 1) % n;
    if (pt == n - 1) {
      if (k == kk) break;
      kk = k;
    }
  }
  cout << ans << endl;
  return 0;
}
