#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100010];
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second;
    a[i].first = a[i].second % 10;
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    if (k == 0) break;
    if (a[i].first == 0) continue;
    if (k >= (10 - a[i].first)) {
      a[i].second += (10 - a[i].first);
      k -= 10 - a[i].first;
    }
  }
  if (k > 9) {
    for (int i = 0; i < n; i++) {
      if (k < 10) break;
      if (a[i].second < 100) {
        int t = 100 - a[i].second;
        if (k >= t) {
          a[i].second += t;
          k -= t;
        } else {
          a[i].second += k;
          k = 0;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += a[i].second / 10;
  cout << ans;
  return 0;
}
