#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, ans = 0, st = -1;
  scanf("%d%d", &n, &k);
  vector<pair<int, int> > v;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
    for (int j = 10; j <= 100; j += 10) {
      if (j - arr[i] >= 0) {
        v.push_back({j - arr[i], arr[i]});
        break;
      }
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; ++i) {
    if (k - v[i].first >= 0) {
      k -= v[i].first;
      v[i].second += v[i].first;
    }
  }
  for (int i = 0; i < n; ++i) {
    ans += v[i].second / 10;
  }
  ans += min((k / 10), ((n * 10) - ans));
  cout << ans << endl;
  return 0;
}
