#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long ans = 0;
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > a(n);
  for (int i = int(0); i < int(n); i++) {
    int first;
    cin >> first;
    if (first == 100) {
      a[i].second = -1;
    } else {
      a[i].second = first / 10;
      a[i].first = first % 10;
    }
  }
  sort(a.rbegin(), a.rend());
  int s = 0, p = 0;
  bool flag = 1;
  while (k > 0) {
    if (a[s].second == -1) {
      break;
    }
    p = 10 - a[s].first;
    if (p > k) {
      flag = 0;
      break;
    }
    k -= p;
    if (a[s].second == 9) {
      a[s].second = -1;
      a[s].first = -1;
    } else {
      a[s].second++;
      a[s].first = 0;
    }
    s++;
    if (s >= n) {
      break;
    }
  }
  if (flag == 1 && k >= 10) {
    s = 0;
    sort(a.rbegin(), a.rend());
    while (k >= 10) {
      if (a[s].second == -1) {
        break;
      }
      p = 100 - a[s].second * 10;
      if (p > k) {
        a[s].second += (k / 10);
        break;
      } else {
        a[s].second = -1;
        a[s].first = -1;
        k -= p;
      }
      s++;
      if (s >= n) {
        break;
      }
    }
  }
  for (int i = int(0); i < int(n); i++) {
    if (a[i].second != -1) {
      ans += a[i].second;
    } else {
      ans += 10;
    }
  }
  cout << ans;
}
