#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int repo = 0;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    ans += (v[i] / 10);
    repo += ((100 - v[i]) / 10) * 10;
    if (v[i] % 10)
      v[i] = 10 - (v[i] % 10);
    else
      v[i] = 0;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n && k; i++) {
    if (v[i] && k >= v[i]) {
      k -= v[i];
      ans++;
    } else if (v[i])
      break;
  }
  if (k) ans += min(k / 10, repo / 10);
  cout << ans << '\n';
}
