easy O(n) Python 3 solution with explanation
Given array from 1 to n, you can always get an arrange of n-1 different |a_i - a_i-1|.  For example, [1,2,3,4,5] you can get [3,2,4,1,5] there are 4 different |
Given array from 1 to n, you can always get an arrange of n-1 different |a_i - a_i-1|. 

For example, [1,2,3,4,5] you can get [3,2,4,1,5] there are 4 different |a_i - a_i-1|. The pattern is reading from the end to start, the last number is the biggest, and second to last is the smallest. Then second largest, then second smallest.

So given n and k, you just need get an arragement for [1,2...k+1] which gives k different |a_i - a_i-1|, the rest will stay the same. 
For example, given n=10, k=7 
[1,2,3,4,5,6,7,8,9,10]
We fixed 1 to 8, we get [8,1,7,2,6,3,5,4], reverse it we get [4,5,3,6,2,7,1,8] and fill the remaining integers until n, then we get
[4,5,3,6,2,7,1,8,9,10]
```
class Solution:
    def constructArray(self, n, k):
        """
        :type n: int
        :type k: int
        :rtype: List[int]
        """
        x, y = k+1, 1
        results = []
        while x >= y:
            if x == y:
                results.append(x)
            else:
                results.extend([x, y])
            x -= 1
            y += 1
        results.reverse()
        for i in range(k+2, n+1):
            results.append(i)
        return results

[]