#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int MAXN = 1e7 + 6;
const int MOD = 1e9 + 7;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int n, k;
vector<int> arr;
bool cmp(int a, int b) { return (a % 10) > (b % 10); }
int main() {
  cin >> n >> k;
  arr.resize(n);
  int rem = 0;
  int ans = 0;
  for (int i = 0; i < int(n); i++) cin >> arr[i], rem += 100 - arr[i];
  k = min(k, rem);
  sort(arr.begin(), arr.end(), cmp);
  for (int i = 0; i < int(n); i++) {
    int cur = 10 - (arr[i] % 10);
    arr[i] += min(cur, k);
    k -= min(cur, k);
    ans += (arr[i] / 10);
  }
  cout << ans + (k / 10);
  return 0;
}
