#include <bits/stdc++.h>
using namespace std;
struct data {
  int z, y;
} a[100005];
bool cmp(data a, data b) { return a.y > b.y; }
int main() {
  int n, k;
  while (cin >> n >> k) {
    int ans = 0, cnt = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i].z;
      if (a[i].z != 0) {
        a[i].y = a[i].z % 10;
        a[i].z = a[i].z / 10;
      } else
        a[i].y = 0;
      ans += a[i].z;
    }
    sort(a, a + n, cmp);
    for (int i = 0; i < n; i++) {
      if (k >= 0 && a[i].z < 10) {
        k = k - 10 + a[i].y;
        ans++;
        a[i].z++;
      }
      cnt += 10 - a[i].z;
    }
    if (k > 0 && n != 0) {
      k = k / 10;
      k = min(k, cnt);
      ans += k;
    }
    if (k < 0) ans--;
    cout << ans << endl;
  }
  return 0;
}
