#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int eps = -1e6;
const int MAX = 100010;
int n, k, ans, a[MAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0, _n = (n); i < _n; ++i) {
    cin >> a[i];
    ans += a[i] / 10;
    a[i] %= 10;
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0, _n = (n); i < _n; ++i) {
    if (k == 0) break;
    int rem = 10 - a[i];
    if (k >= rem) {
      k -= rem;
      ans++;
    }
  }
  ans += k / 10;
  ans = min(n * 10, ans);
  cout << ans << endl;
  return 0;
}
