#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
const long long int INF = 1e9;
const long long int mod = 1e9 + 7;
struct node {
  long long int rem, maxi, in;
};
node first[N];
map<long long int, long long int> mm;
long long int n, k, a[N], cnt = 0;
bool comp(node l, node r) {
  if (l.rem == r.rem) {
    return l.in < r.in;
  }
  return l.rem < r.rem;
}
int main() {
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    first[i].rem = 10 - (a[i] % 10);
    first[i].maxi = 100 - a[i];
    cnt += (a[i] / 10);
    first[i].in = a[i];
  }
  sort(first, first + n, comp);
  while (k) {
    long long int ff = 0;
    for (long long int i = 0; i < n && k; i++) {
      if (first[i].in == 100 || first[i].in + first[i].rem > 100) {
        continue;
      }
      if (k - first[i].rem >= 0) {
        first[i].in += first[i].rem;
        cnt++;
        k -= first[i].rem;
        first[i].rem = 10;
      }
    }
    if (mm[k]) {
      break;
    }
    mm[k]++;
    sort(first, first + n, comp);
  }
  cout << cnt << endl;
}
