#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, k, cnt, a[N];
bool vis[N];
struct data {
  int w, i;
  data() {}
  data(int y, int z) : w(y), i(z) {}
  bool operator<(const data &o) const { return w > o.w; }
};
priority_queue<data> q;
int main() {
  int ans = 0;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    q.push(data(a[i] % 10 == 0 ? 10 : 10 - a[i] % 10, i));
  }
  for (; !q.empty();) {
    data now = q.top();
    q.pop();
    if (a[now.i] == 100)
      vis[now.i] = 1;
    else if (k >= now.w)
      vis[now.i] = 1, k -= now.w;
  }
  bool rt = 1;
  for (int i = 1; i <= n; ++i) {
    if (vis[i]) {
      if (a[i] == 100) continue;
      a[i] = (a[i] % 10 == 0) ? a[i] + 10 : a[i] - a[i] % 10 + 10;
    } else
      rt = 0;
  }
  for (int i = 1; i <= n; ++i) ans += a[i] / 10;
  if (rt == 0) return printf("%d\n", ans), 0;
  for (int i = 1; i <= n; ++i) cnt += (100 - a[i]);
  if (k >= cnt)
    ans += cnt / 10;
  else
    ans += k / 10;
  printf("%d\n", ans);
  return 0;
}
